package com.timsmeet.utils;

public class ArgumentValidator {

	public final static void isNotNull(Object toCheck, String argumentName) {
		if(argumentName == null) {
			argumentName = "argument";
		}
		if(toCheck == null) {
			throw new IllegalArgumentException("The " + argumentName + " should not be null.");
		}
	}
	
	public final static void isNotEmptyString(String toCheck, String argumentName) {
		if(argumentName == null) {
			argumentName = "argument";
		}
		
		if(toCheck.trim().length() == 0) {
			throw new IllegalArgumentException("The " + argumentName + " should not be empty.");
		}
	}
	
	public final static void isNotNullOrEmptyString(String toCheck, String argumentName) {
		isNotNull(toCheck, argumentName);
		
		if(argumentName == null) {
			argumentName = "argument";
		}
		
		if(toCheck.trim().length() == 0) {
			throw new IllegalArgumentException("The " + argumentName + " should not be empty.");
		}
	}
}
